<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
<html>
<head>
	<title>审批管理</title>
	<meta name="decorator" content="default"/>
	<script type="text/javascript">
		$(document).ready(function() {
			
		});
		function page(n,s){
			$("#pageNo").val(n);
			$("#pageSize").val(s);
			$("#searchForm").submit();
        	return false;
        }
	</script>
</head>
<body>
	<ul class="nav nav-tabs">
		<shiro:hasPermission name="oa:budget:edit"><li><a href="${ctx}/oa/budget/form">预算申请</a></li></shiro:hasPermission>
		<li class="active"><a href="${ctx}/oa/budget/">我的申请</a></li>
	</ul>
	<form:form id="searchForm" modelAttribute="budget" action="${ctx}/oa/budget/" method="post" class="breadcrumb form-search">
		<input id="pageNo" name="pageNo" type="hidden" value="${page.pageNo}"/>
		<input id="pageSize" name="pageSize" type="hidden" value="${page.pageSize}"/>
		<label>项目名称：&nbsp;</label>
		<form:input path="title" htmlEscape="false" maxlength="50" class="input-medium" placeholder="请输入项目名称"/>
		<label>预算年度：&nbsp;</label>
		<input id="annual" name="annual" type="text" readonly="readonly" maxlength="20" class="required input-medium Wdate"
			   value="${budget.annual}" onclick="WdatePicker({dateFmt:'yyyy',isShowClear:true});"/>
		&nbsp;<input id="btnSubmit" class="btn btn-primary" type="submit" value="查询"/>
	</form:form>
	<sys:message content="${message}"/>
	<table id="contentTable" class="table table-striped table-bordered table-condensed">
		<thead>
		<tr>
			<th>项目名称</th>
			<th class="tb1th">当前环节</th>
			<th class="tb1th">预算年度</th>
			<th class="tb1th">部门</th>
			<th class="tb1th">项目分类</th>
			<th class="tb1th">所属项目</th>
			<th>申请时间</th>
			<shiro:hasPermission name="oa:budget:edit">
			<th>操作</th>
			</shiro:hasPermission>
		</tr>
		</thead>
		<tbody>
		<c:forEach items="${page.list}" var="budget">
			<tr>
				<td><a href="${ctx}/oa/budget/form?id=${budget.id}">${budget.title}</a></td>
				<td>
					<c:choose>
						<c:when test="${not empty budget.currentAct.histIns.activityName}">
							${budget.currentAct.histIns.activityName}
						</c:when>
						<c:otherwise>
							未提交审核
						</c:otherwise>
					</c:choose>
				</td>
				<td>${budget.annual}</td>
				<td>${budget.office.name}</td>
				<td>${budget.classify.name}</td>
				<td>${budget.category.name}</td>
				<td><fmt:formatDate value="${budget.createDate}" type="both" pattern="yyyy-MM-dd"/></td>
				<shiro:hasPermission name="oa:budget:edit"><td>
				<c:choose>
					<c:when test="${budget.procInsId == null || budget.procInsId == ''}">
						<a href="${ctx}/oa/budget/modify?id=${budget.id}">修改</a>
					</c:when>
					<c:otherwise>
						<a href="${ctx}/oa/budget/form?id=${budget.id}">详情</a>
					</c:otherwise>
				</c:choose>
					<a href="${ctx}/oa/budget/history?id=${budget.id}">历史记录</a>
					<%--<a href="${ctx}/oa/budget/delete?id=${budget.id}" onclick="return confirmx('确认要删除该审批吗？', this.href)">删除</a>--%>
				</td></shiro:hasPermission>
			</tr>
		</c:forEach>
		</tbody>
	</table>
	<div class="pagination">${page}</div>
</body>
</html>
